package com.ruoyi.safe.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.safe.domain.vo.BizSafeDocAttachVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.List;

/**
 * 安全内业资料对象 biz_safe_infor
 * 
 * @author ruoyi
 * @date 2024-01-10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BizSafeInfor extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 序号 */
    private Long id;

    /** 项目ID */
    private Long projectId;

    /** 目录id */
    @Excel(name = "目录id")
    private Long catalogId;

    /** 名称 */
    @Excel(name = "名称")
    private String name;

    /** 创建机构 */
    @Excel(name = "创建机构")
    private Long deptId;

    /** 是否需要创建下级 */
    @Excel(name = "是否需要创建下级")
    private String createJunior;

    /** 父级id */
    @Excel(name = "父级id")
    private Long parentId;

    /** 祖级列表 */
    @Excel(name = "祖级列表")
    private String ancestors;

    /** 节点路径 */
    @JsonIgnore
    private String path;

    /** 排序 */
    private Integer sort;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 安全内业资料文档附件列表 */
    private List<BizSafeDocAttachVO> bizSafeDocAttachList;

    /** 已上传的文件数量 */
    private long uploadedFileCount;

    /** 创建机构名称 */
    private String deptName;
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("projectId", getProjectId())
            .append("catalogId", getCatalogId())
            .append("name", getName())
            .append("deptId", getDeptId())
            .append("createJunior", getCreateJunior())
            .append("parentId", getParentId())
            .append("ancestors", getAncestors())
            .append("sort", getSort())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }

    public BizSafeInfor(BizCatalogDetail bizCatalogDetail){
        this.setCatalogId(bizCatalogDetail.getCatalogId());
        this.setName(bizCatalogDetail.getName());
        this.setCreateJunior(bizCatalogDetail.getCreateJunior());
        this.setDelFlag(bizCatalogDetail.getDelFlag());
        this.setSort(bizCatalogDetail.getSort());
    }

    public String getPath(){
        return this.getAncestors() + "," + this.getId();
    }
}
